﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace UnrealDebugger.Panels
{
    public partial class CommandPanel : Panel
    {
        public CommandPanel()
        {
            InitializeComponent();

            this.textEditorControlCommands.IsReadOnly = true;
        }

        #region Debugger Interface

        public void AddLineToLog(string line)
        {
            string text = DateTime.Now.ToString("[h:mm:ss]  ") + line + "\n";

            this.textEditorControlCommands.IsReadOnly = false;
            this.textEditorControlCommands.ActiveTextAreaControl.TextArea.InsertString(text);
            this.textEditorControlCommands.ActiveTextAreaControl.ScrollToCaret();
            this.textEditorControlCommands.IsReadOnly = true;
        }

        #endregion

        private void textBoxExecute_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Return)
            {
                UnrealDebuggerIDE.Commands.Execute(textBoxExecute.Text);
                textBoxExecute.Text = "";
            }
        }
    }
}
